package com.liqi.web.controller.statistics;


import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.liqi.common.annotation.Log;
import com.liqi.common.core.controller.BaseController;
import com.liqi.common.core.domain.AjaxResult;
import com.liqi.common.enums.BusinessType;
import com.liqi.common.utils.poi.ExcelUtil;
import com.liqi.statistics.domain.DvServiceStatistics;
import com.liqi.statistics.service.IDvServiceStatisticsService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import com.liqi.common.core.page.TableDataInfo;

/**
 * 事项统计点击数Controller
 * 
 * @author zh
 * @date 2022-10-28
 */
@Api(tags = "事项点击统计")
@RestController
@RequestMapping("/system/statistics")
public class DvServiceStatisticsController extends BaseController
{
    @Autowired
    private IDvServiceStatisticsService dvServiceStatisticsService;

    /**
     * 查询事项统计点击数列表
     */
    @ApiOperation("事项点击统计查询")
    @PreAuthorize("@ss.hasPermi('system:statistics:list')")
    @GetMapping("/list")
    public TableDataInfo list(DvServiceStatistics dvServiceStatistics)
    {
        startPage();
        List<DvServiceStatistics> list = dvServiceStatisticsService.selectDvServiceStatisticsList(dvServiceStatistics);
        return getDataTable(list);
    }

    /**
     * 导出事项统计点击数列表
     */
    @ApiOperation("事项点击统计导出")
    @PreAuthorize("@ss.hasPermi('system:statistics:export')")
    @Log(title = "事项统计点击数", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DvServiceStatistics dvServiceStatistics)
    {
        List<DvServiceStatistics> list = dvServiceStatisticsService.selectDvServiceStatisticsList(dvServiceStatistics);
        ExcelUtil<DvServiceStatistics> util = new ExcelUtil<DvServiceStatistics>(DvServiceStatistics.class);
        util.exportExcel(response, list, "事项统计点击数数据");
    }

    /**
     * 获取事项统计点击数详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:statistics:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(dvServiceStatisticsService.selectDvServiceStatisticsById(id));
    }

    /**
     * 新增事项统计点击数
     */
    @ApiOperation("事项点击统计新增")
    @PreAuthorize("@ss.hasPermi('system:statistics:add')")
    @Log(title = "事项统计点击数", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DvServiceStatistics dvServiceStatistics)
    {
        return toAjax(dvServiceStatisticsService.insertDvServiceStatistics(dvServiceStatistics));
    }

    /**
     * 修改事项统计点击数
     */
    @ApiOperation("事项点击统计修改")
    @PreAuthorize("@ss.hasPermi('system:statistics:edit')")
    @Log(title = "事项统计点击数", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DvServiceStatistics dvServiceStatistics)
    {
        return toAjax(dvServiceStatisticsService.updateDvServiceStatistics(dvServiceStatistics));
    }

    /**
     * 删除事项统计点击数
     */
    @ApiOperation("事项点击统计删除")
    @PreAuthorize("@ss.hasPermi('system:statistics:remove')")
    @Log(title = "事项统计点击数", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(dvServiceStatisticsService.deleteDvServiceStatisticsByIds(ids));
    }
}
